\(\int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx\) [215]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [B] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 15, antiderivative size = 23 \[ \int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx=-\frac {\text {arctanh}\left (\frac {\cos (c+d x)}{\sqrt {2}}\right )}{\sqrt {2} d} \]

[Out]

-1/2*arctanh(1/2*cos(d*x+c)*2^(1/2))/d*2^(1/2)

Rubi [A] (verified)

Time = 0.05 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {4482, 3265, 212} \[ \int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx=-\frac {\text {arctanh}\left (\frac {\cos (c+d x)}{\sqrt {2}}\right )}{\sqrt {2} d} \]

[In]

Int[(Csc[c + d*x] + Sin[c + d*x])^(-1),x]

[Out]

-(ArcTanh[Cos[c + d*x]/Sqrt[2]]/(Sqrt[2]*d))

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 3265

Int[sin[(e_.) + (f_.)*(x_)]^(m_.)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^(p_.), x_Symbol] :> With[{ff = Free
Factors[Cos[e + f*x], x]}, Dist[-ff/f, Subst[Int[(1 - ff^2*x^2)^((m - 1)/2)*(a + b - b*ff^2*x^2)^p, x], x, Cos
[e + f*x]/ff], x]] /; FreeQ[{a, b, e, f, p}, x] && IntegerQ[(m - 1)/2]

Rule 4482

Int[u_, x_Symbol] :> Int[TrigSimplify[u], x] /; TrigSimplifyQ[u]

Rubi steps \begin{align*} \text {integral}& = \int \frac {\sin (c+d x)}{1+\sin ^2(c+d x)} \, dx \\ & = -\frac {\text {Subst}\left (\int \frac {1}{2-x^2} \, dx,x,\cos (c+d x)\right )}{d} \\ & = -\frac {\text {arctanh}\left (\frac {\cos (c+d x)}{\sqrt {2}}\right )}{\sqrt {2} d} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.63 (sec) , antiderivative size = 61, normalized size of antiderivative = 2.65 \[ \int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx=-\frac {\text {arctanh}\left (\frac {\cos (c)-(-i+\sin (c)) \tan \left (\frac {d x}{2}\right )}{\sqrt {2}}\right )+\text {arctanh}\left (\frac {\cos (c)-(i+\sin (c)) \tan \left (\frac {d x}{2}\right )}{\sqrt {2}}\right )}{\sqrt {2} d} \]

[In]

Integrate[(Csc[c + d*x] + Sin[c + d*x])^(-1),x]

[Out]

-((ArcTanh[(Cos[c] - (-I + Sin[c])*Tan[(d*x)/2])/Sqrt[2]] + ArcTanh[(Cos[c] - (I + Sin[c])*Tan[(d*x)/2])/Sqrt[
2]])/(Sqrt[2]*d))

Maple [A] (verified)

Time = 0.38 (sec) , antiderivative size = 21, normalized size of antiderivative = 0.91

method result size
derivativedivides \(-\frac {\operatorname {arctanh}\left (\frac {\cos \left (d x +c \right ) \sqrt {2}}{2}\right ) \sqrt {2}}{2 d}\) \(21\)
default \(-\frac {\operatorname {arctanh}\left (\frac {\cos \left (d x +c \right ) \sqrt {2}}{2}\right ) \sqrt {2}}{2 d}\) \(21\)
risch \(\frac {\sqrt {2}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-2 \sqrt {2}\, {\mathrm e}^{i \left (d x +c \right )}+1\right )}{4 d}-\frac {\sqrt {2}\, \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+2 \sqrt {2}\, {\mathrm e}^{i \left (d x +c \right )}+1\right )}{4 d}\) \(70\)

[In]

int(1/(csc(d*x+c)+sin(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

-1/2*arctanh(1/2*cos(d*x+c)*2^(1/2))/d*2^(1/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 44 vs. \(2 (20) = 40\).

Time = 0.25 (sec) , antiderivative size = 44, normalized size of antiderivative = 1.91 \[ \int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx=\frac {\sqrt {2} \log \left (-\frac {\cos \left (d x + c\right )^{2} - 2 \, \sqrt {2} \cos \left (d x + c\right ) + 2}{\cos \left (d x + c\right )^{2} - 2}\right )}{4 \, d} \]

[In]

integrate(1/(csc(d*x+c)+sin(d*x+c)),x, algorithm="fricas")

[Out]

1/4*sqrt(2)*log(-(cos(d*x + c)^2 - 2*sqrt(2)*cos(d*x + c) + 2)/(cos(d*x + c)^2 - 2))/d

Sympy [F]

\[ \int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx=\int \frac {1}{\sin {\left (c + d x \right )} + \csc {\left (c + d x \right )}}\, dx \]

[In]

integrate(1/(csc(d*x+c)+sin(d*x+c)),x)

[Out]

Integral(1/(sin(c + d*x) + csc(c + d*x)), x)

Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 176 vs. \(2 (20) = 40\).

Time = 0.31 (sec) , antiderivative size = 176, normalized size of antiderivative = 7.65 \[ \int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx=\frac {\sqrt {2} \log \left (-\frac {2 \, {\left (\sqrt {2} + 1\right )} \cos \left (d x + c\right ) - \cos \left (d x + c\right )^{2} - \sin \left (d x + c\right )^{2} - 2 \, \sqrt {2} - 3}{2 \, {\left (\sqrt {2} - 1\right )} \cos \left (d x + c\right ) + \cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} - 2 \, \sqrt {2} + 3}\right ) + \sqrt {2} \log \left (-\frac {2 \, {\left (\sqrt {2} - 1\right )} \cos \left (d x + c\right ) - \cos \left (d x + c\right )^{2} - \sin \left (d x + c\right )^{2} + 2 \, \sqrt {2} - 3}{2 \, {\left (\sqrt {2} + 1\right )} \cos \left (d x + c\right ) + \cos \left (d x + c\right )^{2} + \sin \left (d x + c\right )^{2} + 2 \, \sqrt {2} + 3}\right )}{8 \, d} \]

[In]

integrate(1/(csc(d*x+c)+sin(d*x+c)),x, algorithm="maxima")

[Out]

1/8*(sqrt(2)*log(-(2*(sqrt(2) + 1)*cos(d*x + c) - cos(d*x + c)^2 - sin(d*x + c)^2 - 2*sqrt(2) - 3)/(2*(sqrt(2)
 - 1)*cos(d*x + c) + cos(d*x + c)^2 + sin(d*x + c)^2 - 2*sqrt(2) + 3)) + sqrt(2)*log(-(2*(sqrt(2) - 1)*cos(d*x
 + c) - cos(d*x + c)^2 - sin(d*x + c)^2 + 2*sqrt(2) - 3)/(2*(sqrt(2) + 1)*cos(d*x + c) + cos(d*x + c)^2 + sin(
d*x + c)^2 + 2*sqrt(2) + 3)))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 68 vs. \(2 (20) = 40\).

Time = 0.30 (sec) , antiderivative size = 68, normalized size of antiderivative = 2.96 \[ \int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx=\frac {\sqrt {2} \log \left (\frac {{\left | -4 \, \sqrt {2} - \frac {2 \, {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + 6 \right |}}{{\left | 4 \, \sqrt {2} - \frac {2 \, {\left (\cos \left (d x + c\right ) - 1\right )}}{\cos \left (d x + c\right ) + 1} + 6 \right |}}\right )}{4 \, d} \]

[In]

integrate(1/(csc(d*x+c)+sin(d*x+c)),x, algorithm="giac")

[Out]

1/4*sqrt(2)*log(abs(-4*sqrt(2) - 2*(cos(d*x + c) - 1)/(cos(d*x + c) + 1) + 6)/abs(4*sqrt(2) - 2*(cos(d*x + c)
- 1)/(cos(d*x + c) + 1) + 6))/d

Mupad [B] (verification not implemented)

Time = 23.38 (sec) , antiderivative size = 42, normalized size of antiderivative = 1.83 \[ \int \frac {1}{\csc (c+d x)+\sin (c+d x)} \, dx=\frac {\sqrt {2}\,\mathrm {atanh}\left (\frac {2\,\sqrt {2}\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2}{2\,{\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1}\right )}{2\,d} \]

[In]

int(1/(sin(c + d*x) + 1/sin(c + d*x)),x)

[Out]

(2^(1/2)*atanh((2*2^(1/2)*sin(c/2 + (d*x)/2)^2)/(2*sin(c/2 + (d*x)/2)^2 + 1)))/(2*d)